# -*- coding: utf-8 -*-
'''
Created on 23 Mar 2011

@author: serj
'''
from google.appengine.ext import db

class Blogger(db.Model):
    user = db.UserProperty()
    token = db.StringProperty()
    host = db.StringProperty(required=True)
    wave_id = db.StringProperty(required=True)
    
    @staticmethod
    def exists(wave_id, host):
        query = db.GqlQuery("SELECT __key__ FROM Blogger WHERE wave_id = :1 AND host = :2",
                             wave_id, host)
        if query.fetch(1):
            return True
        return False
    
class HtmlService(db.Model):
    user_id = db.StringProperty(required=True)
    token = db.StringProperty(required=True)
    wave_id = db.StringProperty(required=True)
    doc = db.TextProperty()